package day04;

import java.util.*;

/**
 * @Auther: sky
 * @Date: 2019/2/26 22:17
 * @Description:集合
 */
public class Collections {

    private String name;
    private static String hello = "hello";

    public Collections(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        //有序可重复
        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add(null);
        //有问题
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String strs = iterator.next();
            if (strs.equals("1")) {
                list.remove("1");
            }else {
                System.out.println(strs);
            }

        }

        for (String lis : list) {

//            System.out.println(lis);
        }

        //无序不可重复
        Set<Collections> set = new HashSet<>();
        Collections collections = new Collections("hello");
        set.add(collections);
        set.add(collections);
        set.add(null);
        set.add(null);
        for (Collections lis : set) {
//            System.out.println(lis);
        }

        Set<String> sets = new HashSet<>();
        sets.add(hello);
        sets.add(hello);
        String name = "1";
        sets.add(name);
        sets.add(name);
        sets.add(hello);
        for (String lis : sets) {
//            sets.add("2");
//            System.out.println(lis);
        }


    }


}
